// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  putRequest,
  postRequest,
  deleteRequest,
  uploadFile
} from "@/libs/axios";

// 获取合作伙伴分页列表
export const getPatherPage = (params) => {
  return getRequest("/home/setting/partners", params);
};

// 上传合作伙伴LOGO
export const postUpload = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest(uploadFile, params, headers);
};

// 根据ID获取合作伙伴详情
export const getPatherDetail = (id) => {
  return getRequest(`/home/setting/partners/${id}`);
};

// 新增合作伙伴
export const postAddPather = (params) => {
  let headers = { "Content-Type": "application/json"};
  return postRequest("/home/setting/partners", params, headers);
};

// 编辑合作伙伴
export const putUpdatePather = (params) => {
  let headers = { "Content-Type": "application/json"};
  return putRequest('/home/setting/partners', params, headers);
};

// 删除合作伙伴
export const delPather = (ids) => {
  return deleteRequest(`/home/setting/partners/${ids}`);
};

// 获取轮播图列表
export const getBannerList = () => {
  return getRequest(`/home/setting/getCurrentHomePics/PC`);
};

// 保存轮播图
export const updateBanner = (params) => {
  let headers = { "Content-Type": "application/json"};
  return postRequest('/home/setting/addHomePics', params, headers);
};

// 删除轮播图
export const delBanner = (id) => {
  return deleteRequest(`/home/setting/delHomePics/${id}`);
};

// 获取图片列表
export const getImageList = (params) => {
  return getRequest('/home/setting/getHomePics', params);
};

// 上传图片
export const postUploadBanner = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest('/home/setting/file', params, headers);
};